home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / usr / lib / gimp / 2.0 / plug-ins / palette-offset.pyc (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2009-04-20  |  1.6 KB  |  34 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.6)
  3.  
  4. from gimpfu import *
  5. gettext.install('gimp20-python', gimp.locale_directory, unicode = True)
  6.  
  7. def palette_offset(palette, amount):
  8.     editable = pdb.gimp_palette_is_editable(palette)
  9.     if not editable:
  10.         palette = pdb.gimp_palette_duplicate(palette)
  11.     
  12.     num_colors = pdb.gimp_palette_get_info(palette)
  13.     tmp_entry_array = []
  14.     for i in xrange(num_colors):
  15.         tmp_entry_array.append((pdb.gimp_palette_entry_get_name(palette, i), pdb.gimp_palette_entry_get_color(palette, i)))
  16.     
  17.     for i in xrange(num_colors):
  18.         target_index = i + amount
  19.         if target_index >= num_colors:
  20.             target_index -= num_colors
  21.         elif target_index < 0:
  22.             target_index += num_colors
  23.         
  24.         pdb.gimp_palette_entry_set_name(palette, target_index, tmp_entry_array[i][0])
  25.         pdb.gimp_palette_entry_set_color(palette, target_index, tmp_entry_array[i][1])
  26.     
  27.     return palette
  28.  
  29. register('python-fu-palette-offset', N_('Offset the colors in a palette'), 'palette_offset (palette, amount) -> modified_palette', 'Joao S. O. Bueno Calligaris, Carol Spears', '(c) Joao S. O. Bueno Calligaris', '2004, 2006', N_('_Offset Palette...'), '', [
  30.     (PF_PALETTE, 'palette', _('Palette'), ''),
  31.     (PF_INT, 'amount', _('Off_set'), 1)], [
  32.     (PF_PALETTE, 'new-palette', 'Result')], palette_offset, menu = '<Palettes>', domain = ('gimp20-python', gimp.locale_directory))
  33. main()
  34.